<?php
/**
*	file: ilpcsr.php
*	path: /webroot/forms/
*	notes:   
*		this form was updated with VAIL customization on 10-15-08.
*		edited static content with VAIL text
*		DONE
*/


   #get consumer metadata from consumer table
   $query2 = "SELECT * 
			   FROM consumer 
			   WHERE id = ".$id;

   #store consumer metadata
   $row2 = mysql_fetch_array(mysql_query($query2));


   #get ilpcsr data from ilpcsr table for this consumer
   $query = "SELECT * 
			 FROM ilpcsr 
			 WHERE consumer_id = ".$id;

   #store ilpcsr data and use this to populate form 
   $result = mysql_query($query);

   #if data was retrieved from ilpcsr table, set form vars
   if($row = mysql_fetch_array($result)) {
	
	$status         	= $row["status"];
	$csr            		= $row["csr"];
	$ilp            		= $row["ilp"];
	$ilpWritten     	= $row["ilp_written"];
	$csp            		= $row["csp"];
	$ocp            		= $row["ocp"];
	$completionDate = $row["completion_date"];
	
        //get chunks of data to create human-readable date format
        if($completionDate) {
		$completionDateMonth  	= substr($completionDate, 5, 2);
		$completionDateDay    	= substr($completionDate, 8, 2);
		$completionDateYear   	= substr($completionDate, 0, 4);
	}

	$primaryILPGoal = $row["primary_ilp_goal"];
	$frequencyContact = $row["frequency_contact"];
	
	$firstContactDate = $row["first_contact_date"];
	if($firstContactDate) {
		$firstContactDateMonth = substr($firstContactDate, 5, 2);
		$firstContactDateDay = substr($firstContactDate, 8, 2);
		$firstContactDateYear = substr($firstContactDate, 0, 4);
	}
	
	$consumerResponsibilities = $row["consumer_responsibilities"];
	$coordinatorResponsibilities = $row["coordinator_responsibilities"];
	
	$targetCompletionDate = $row["target_completion_date"];
	if($targetCompletionDate) {
		$targetCompletionDateMonth = substr($targetCompletionDate, 5, 2);
		$targetCompletionDateDay = substr($targetCompletionDate, 8, 2);
		$targetCompletionDateYear = substr($targetCompletionDate, 0, 4);
	}
	
	$actualCompletionDate = $row["actual_completion_date"];
	if($actualCompletionDate) {
		$actualCompletionDateMonth = substr($actualCompletionDate, 5, 2);
		$actualCompletionDateDay = substr($actualCompletionDate, 8, 2);
		$actualCompletionDateYear = substr($actualCompletionDate, 0, 4);
	}
	
	$ilpCopySignoff 		= $row["ilp_copy_signoff"];
	$ilpConsumerSig 		= $row["ilp_consumer_sig"];
	$ilpGuardianSig 		= $row["ilp_guardian_sig"];
	$ilpSocialServiceSig	 = $row["ilp_social_service_sig"];
	$ilpCoordinatorSig 	= $row["ilp_coordinator_sig"];
	$csrConsumerSig 		= $row["csr_consumer_sig"];

   }
   #we have the basic ILP / CSR information.  further below
   #we will gather ILP objectives, objective types, etc in one large loop
?>
<form action="actions/ProcessIlpCsr.php" method="post"/>

   <div style="border:1px #ddd solid;padding:3px;">
   
       <h2><?php echo THIS_CIL;?>  ILP/CSR</h2>
  
		<table class="table1">
			<tbody>
				<tr>
					<td colspan="3">
						<h3><?php echo THIS_CIL;?>  INDEPENDENT LIVING PLAN</h3>
					</td>
				</tr>
				<tr>
					<td>
						<label>CSR</label>
						<input name="csr" type="checkbox" <?php if($csr=="1") echo "checked";?>>
					</td>
					<td align="center" style="background-color:#F3F781;">
						<strong><label>Active?</label></strong>
						<input name="status" type="checkbox" <?php if($status=="1") echo "checked";?>>
					</td>
					<td align="right">
						<input name="ilp" type="checkbox" <?php if($ilp=="1") echo "checked";?>>
						<label>ILP</label>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<strong>Note:</strong> 
						If CSR is checked make sure consumer signs this form. 
					</td>
				</tr>
				<tr>
					<td colspan="3">	
						<strong>Today&#39;s Date:</strong> 
						<?php echo date("F j, Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));?>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<input name="ilpWritten" type="checkbox" <?php if($ilpWritten=="1") echo "checked";?>>
						ILP written, needs signatures. 
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<input name="csp" type="checkbox" <?php if($csp=="1") echo "checked";?>>
						Consumer services plan, sign waiver. 
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<input name="ocp" type="checkbox" <?php if($ocp=="1") echo "checked";?>>
						Overall Completion Date 
					</td>
					<td align="right">
						<div>
							<select name="completionDateMonth" id="completionDateMonth">
								<option value=""> --- </option>
						              <option value="01">January</option>
						              <option value="02">February</option>
						              <option value="03">March</option>
						              <option value="04">April</option>
						              <option value="05">May</option>
						              <option value="06">June</option>
						              <option value="07">July</option>
						              <option value="08">August</option>
						              <option value="09">September</option>
						              <option value="10">October</option>
						              <option value="11">November</option>
						              <option value="12">December</option>
							</select>
							<script>					
								for(i=0; i<$('completionDateMonth').options.length; i++) {
									if($('completionDateMonth').options[i].value=='<? echo $completionDateMonth ?>') {
										$('completionDateMonth').options[i].selected = true;
									}
								}
							</script>
							<select name="completionDateDay" id="completionDateDay">
								<option value=""> --- </option>
								<?php 
									for($i=1; $i<32; $i++) {
										if($i<10)
											echo "<option value=\"0".$i."\">".$i."</option>";
										else
											echo "<option value=\"".$i."\">".$i."</option>";
									}?>
							</select>
							<script>					
								for(i=0; i<$('completionDateDay').options.length; i++) {
									if($('completionDateDay').options[i].value=='<? echo $completionDateDay ?>') {
										$('completionDateDay').options[i].selected = true;
									}
								}
							</script>
							<select name="completionDateYear" id="completionDateYear">
								<option value=""> --- </option>
								<?php
								for($i=-1; $i<10; $i++) {
									$year = date("Y", mktime(0,0,0,1,1,date("Y")-$i));
									echo "<option value=\"".$year."\">".$year."</option>";
								}?>
							</select>
							<script>					
								for(i=0; i<$('completionDateYear').options.length; i++) {
									if($('completionDateYear').options[i].value=='<? echo $completionDateYear ?>') {
										$('completionDateYear').options[i].selected = true;
									}
								}
							</script>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<h3>Primary Independent Living Goal</h3>
					</td>
				</tr>
				<tr>
					<td colspan="10">
						<input name="primaryILPGoal" 
						value="<?php echo $primaryILPGoal; ?>" type="text" 
						style="margin:5px;width:95%;height:60px;">
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<h3>Scheduling Compliance </h3>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<table width="100%">
							<tbody>
							<tr>
								<td>
									<label name="firstContactDate">1st Contact Date</label>
									<br>
									<select name="firstContactDateMonth" id="firstContactDateMonth">
										<option value=""> --- </option>
											<option value="01">January</option>
								                    <option value="02">February</option>
								                    <option value="03">March</option>
								                    <option value="04">April</option>
								                    <option value="05">May</option>
								                    <option value="06">June</option>
								                    <option value="07">July</option>
								                    <option value="08">August</option>
								                    <option value="09">September</option>
								                    <option value="10">October</option>
								                    <option value="11">November</option>
								                    <option value="12">December</option>
									</select>
									<script>					
										for(i=0; i<$('firstContactDateMonth').options.length; i++) {
											if($('firstContactDateMonth').options[i].value=='<? echo $firstContactDateMonth ?>') {
												$('firstContactDateMonth').options[i].selected = true;
											}
										}
									</script>
									<select name="firstContactDateDay" id="firstContactDateDay">
										<option value=""> --- </option>
										<?php 
											for($i=1; $i<32; $i++) {
												if($i<10)
													echo "<option value=\"0".$i."\">".$i."</option>";
												else
													echo "<option value=\"".$i."\">".$i."</option>";
											}?>
									</select>
									<script>					
										for(i=0; i<$('firstContactDateDay').options.length; i++) {
												if($('firstContactDateDay').options[i].value=='<? echo $firstContactDateDay ?>') {
													$('firstContactDateDay').options[i].selected = true;
												}
										}
									</script>
									<select name="firstContactDateYear" id="firstContactDateYear">
										<option value=""> --- </option>
										<?php
											for($i=0; $i<10; $i++) {
												$year = date("Y", mktime(0,0,0,1,1,date("Y")-$i));
												echo "<option value=\"".$year."\">".$year."</option>";
											}?>
									</select>
									<script>					
										for(i=0; i<$('firstContactDateYear').options.length; i++) {
											if($('firstContactDateYear').options[i].value=='<? echo $firstContactDateYear ?>') {
												$('firstContactDateYear').options[i].selected = true;
											}
										}
									</script>
								</td>
								<td>
									<label name="frequencyOfContact">
										Planned Frequency of Contact
									</label>
									<br>
									<select name="frequencyContact">
										<option value=""> --- </option>
										<option <?php if($frequencyContact=="weekly") echo "selected "?> value="weekly">Weekly</option>
										<option <?php if($frequencyContact=="bi-monthly") echo "selected "?> value="bi-monthly">Bi-Monthly</option>
										<option <?php if($frequencyContact=="monthly") echo "selected "?> value="monthly">Monthly</option>
										<option <?php if($frequencyContact=="quarterly") echo "selected "?> value="quarterly">Quarterly</option>
										<option <?php if($frequencyContact=="annually") echo "selected "?> value="annually">Annually</option>
									</select>
								</td>
							</tr>
							</tbody>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<h3>ILP Objectives</h3>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<table class="table2">
						<tbody>
						<?php

							#okay, we're going to do one large loop to get all the consumer's
							#objectives and related data
							$ilpId = $row["id"];
							
							//OUR LOOP IS LIMITED TO 5 ILP OBJECTIVES
							
							#THE OBJECTIVES LOOP!
							for($i=1; $i<5; $i++) { 
								//query
								$ilp_goal_query = "SELECT * 
													FROM ilpcsr_goal 
													WHERE ilp_id = ".$ilpId." and goal_nbr = ".$i;
													
								//result
								$ilp_result = mysql_query($ilp_goal_query);
								
								//handle return data
								if($row2 = mysql_fetch_array($ilp_result)) {
								
									$objectiveId = $row2["ilp_objective_id"];
									
									//make set date human-readable
									$setDate = $row2["goal_set_date"];
									if($setDate) {
										$setDateMonth = substr($setDate, 5, 2);
										$setDateDay = substr($setDate, 8, 2);
										$setDateYear = substr($setDate, 0, 4);
									}
									
									//make target date human readable
									$targetDate = $row2["goal_target_date"];
									if($targetDate) {
										$targetDateMonth = substr($targetDate, 5, 2);
										$targetDateDay = substr($targetDate, 8, 2);
										$targetDateYear = substr($targetDate, 0, 4);
									}
									
									//make set date human readable
									$metDate = $row2["goal_met_date"];
									if($metDate) {
										$metDateMonth = substr($metDate, 5, 2);
										$metDateDay = substr($metDate, 8, 2);
										$metDateYear = substr($metDate, 0, 4);
									}
									
								} else {
									
									//this consumer has no data stored in db,
									//make everything 
									$objectiveId 		= null;
									$setDateMonth 	= null;
									$setDateDay 		= null;
									$setDateYear 		= null;								
									$targetDateMonth = null;
									$targetDateDay 	= null;
									$targetDateYear 	= null;
									$metDateMonth 	= null;
									$metDateDay 		= null;
									$metDateYear 	= null;
									
								}
							#we have our data, now handle the form
						?>
								<tr>
									<td>
										<label>Coordinator</label>
										<br>
										<input name="coordinatorInvolved<? echo $i ?>" style="width:190px" 
										value="<?php echo $row2["coordinator_involved"];?>" type="text">
									</td>
									<td>
										<label>Objective</label>
										<br>
										<select name="ilpObjective<? echo $i ?>">
											<option value=""> --- </option>
											<?php 
												//get list of objectives 
												$objQuery = "SELECT * FROM lst_ilp_objective";
												//result
												$objResult = mysql_query($objQuery);
		                    
												while($row=mysql_fetch_array($objResult)) {
													$obj_id = $row["id"];
													$objective = $row["objective"];
													
													if($objectiveId==$obj_id)
														//if objective is stored, make sure its selected
														echo "<option value=\"".$obj_id."\" selected>".$objective."</option>";
													else
														echo "<option value=\"".$obj_id."\">".$objective."</option>";
												}
											?>
										</select>
									</td>
									<td>
										<label>Goal Set</label>
										<br>
										<select name="goalSetDate<? echo $i ?>Month" id="goalSetDate<? echo $i ?>Month">
											<option value=""> --- </option>
								                    <option value="01">January</option>
								                    <option value="02">February</option>
								                    <option value="03">March</option>
								                    <option value="04">April</option>
								                    <option value="05">May</option>
								                    <option value="06">June</option>
								                    <option value="07">July</option>
								                    <option value="08">August</option>
								                    <option value="09">September</option>
								                    <option value="10">October</option>
								                    <option value="11">November</option>
								                    <option value="12">December</option>
										</select>
										<script>					
											for(i=0; i<$('goalSetDate<? echo $i ?>Month').options.length; i++) {
												if($('goalSetDate<? echo $i ?>Month').options[i].value=='<? echo $setDateMonth ?>') {
													$('goalSetDate<? echo $i ?>Month').options[i].selected = true;
												}
											}
										</script>
										<select name="goalSetDate<? echo $i ?>Day" id="goalSetDate<? echo $i ?>Day">
											<option value=""> --- </option>
											<?php 
												for($j=1; $j<32; $j++) {
													if($j<10)
														echo "<option value=\"0".$j."\">".$j."</option>";
													else
														echo "<option value=\"".$j."\">".$j."</option>";
												}?>
										</select>
										<script>					
											for(i=0; i<$('goalSetDate<? echo $i ?>Day').options.length; i++) {
												if($('goalSetDate<? echo $i ?>Day').options[i].value=='<? echo $setDateDay ?>') {
													$('goalSetDate<? echo $i ?>Day').options[i].selected = true;
												}
											}
										</script>
										<select name="goalSetDate<? echo $i ?>Year" id="goalSetDate<? echo $i ?>Year">
											<option value=""> --- </option>
											<?php			
												for($j=0; $j<10; $j++) {
													$year = date("Y", mktime(0,0,0,1,1,date("Y")-$j));
													echo "<option value=\"".$year."\">".$year."</option>";
												}
											?>
										</select>
										<script>					
											for(i=0; i<$('goalSetDate<? echo $i ?>Year').options.length; i++) {
												if($('goalSetDate<? echo $i ?>Year').options[i].value=='<? echo $setDateYear ?>') {
													$('goalSetDate<? echo $i ?>Year').options[i].selected = true;
												}
											}
										</script>
									</td>
								</tr>
								<tr>
									<td>
										<label>Target Date</label>
										<br>
										<select name="goalTargetDate<? echo $i ?>Month" id="goalTargetDate<? echo $i ?>Month">
								                    <option value=""> --- </option>
								                    <option value="01">January</option>
								                    <option value="02">February</option>
								                    <option value="03">March</option>
								                    <option value="04">April</option>
								                    <option value="05">May</option>
								                    <option value="06">June</option>
								                    <option value="07">July</option>
								                    <option value="08">August</option>
								                    <option value="09">September</option>
								                    <option value="10">October</option>
								                    <option value="11">November</option>
								                    <option value="12">December</option>
										</select>
										<script>					
											for(i=0; i<$('goalTargetDate<? echo $i ?>Month').options.length; i++) {
												if($('goalTargetDate<? echo $i ?>Month').options[i].value=='<? echo $targetDateMonth ?>') {
													$('goalTargetDate<? echo $i ?>Month').options[i].selected = true;
												}
											}
										</script>
										<select name="goalTargetDate<? echo $i ?>Day" id="goalTargetDate<? echo $i ?>Day">
											<option value=""> --- </option>
											<?php 
												for($j=1; $j<32; $j++) {
													if($j<10)
														echo "<option value=\"0".$j."\">".$j."</option>";
													else
														echo "<option value=\"".$j."\">".$j."</option>";
												}
											?>
										</select>
										<script>					
											for(i=0; i<$('goalTargetDate<? echo $i ?>Day').options.length; i++) {
												if($('goalTargetDate<? echo $i ?>Day').options[i].value=='<? echo $targetDateDay ?>') {
													$('goalTargetDate<? echo $i ?>Day').options[i].selected = true;
												}
											}
										</script>
										<select name="goalTargetDate<? echo $i ?>Year" id="goalTargetDate<? echo $i ?>Year">
											<option value=""> --- </option>
											<?php
												for($j=0; $j<10; $j++) {
													$year = date("Y", mktime(0,0,0,1,1,date("Y")+2-$j));
													echo "<option value=\"".$year."\">".$year."</option>";
												}
											?>
										</select>
										<script>					
											for(i=0; i<$('goalTargetDate<? echo $i ?>Year').options.length; i++) {
												if($('goalTargetDate<? echo $i ?>Year').options[i].value=='<? echo $targetDateYear ?>') {
													$('goalTargetDate<? echo $i ?>Year').options[i].selected = true;
												}
											}
										</script>
									</td>
									<td>
										<label>Goal Met</label>
										<br>
										<select name="goalMetDate<? echo $i ?>Month" id="goalMetDate<? echo $i ?>Month">
								                    <option value=""> --- </option>
								                    <option value="01">January</option>
								                    <option value="02">February</option>
								                    <option value="03">March</option>
								                    <option value="04">April</option>
								                    <option value="05">May</option>
								                    <option value="06">June</option>
								                    <option value="07">July</option>
								                    <option value="08">August</option>
								                    <option value="09">September</option>
								                    <option value="10">October</option>
								                    <option value="11">November</option>
								                    <option value="12">December</option>
										</select>
										<script>					
											for(i=0; i<$('goalMetDate<? echo $i ?>Month').options.length; i++) {
												if($('goalMetDate<? echo $i ?>Month').options[i].value=='<? echo metDateMonth ?>') {
													$('goalMetDate<? echo $i ?>Month').options[i].selected = true;
												}
											}
										</script>
										<select name="goalMetDate<? echo $i ?>Day" id="goalMetDate<? echo $i ?>Day">
											<option value=""> --- </option>
											<?php 
												for($j=1; $j<32; $j++) {
													if($j<10)
														echo "<option value=\"0".$j."\">".$j."</option>";
													else
														echo "<option value=\"".$j."\">".$j."</option>";
												}
											?>
										</select>
										<script>					
											for(i=0; i<$('goalMetDate<? echo $i ?>Day').options.length; i++) {
												if($('goalMetDate<? echo $i ?>Day').options[i].value=='<? echo $metDateDay ?>') {
													$('goalMetDate<? echo $i ?>Day').options[i].selected = true;
												}
											}
										</script>
										<select name="goalMetDate<? echo $i ?>Year" id="goalMetDate<? echo $i ?>Year">
											<option value=""> --- </option>
											<?php
												for($j=0; $j<10; $j++) {
													$year = date("Y", mktime(0,0,0,1,1,date("Y")-$j));
													echo "<option value=\"".$year."\">".$year."</option>";
												}
											?>
										</select>
										<script>					
											for(i=0; i<$('goalMetDate1Year').options.length; i++) {
												if($('goalMetDate1Year').options[i].value=='<? echo $metDateYear ?>') {
													$('goalMetDate1Year').options[i].selected = true;
												}
											}
										</script>
									</td>
								</tr>
								<tr>
									<td>&nbsp;</td>
								</tr>
						<?php 
							}		 
							#END OF THE OBJECTIVES LOOP
							//and thats all it was : )
						?>
				<tr>
					<td><br></td>
				</tr>
				</tbody>
			</table>
		</td>
	</tr>
      <tr>
		<td></td>
	</tr>
	<tr>
		<td>
			<label name="consumerResponsibilities">
				Responsibilities of Consumer
			</label>
			<br>
			<input type="text" name="consumerResponsibilities" style="width:260px" value="<?php echo $consumerResponsibilities; ?>">
		</td>
        <td></td>
        <td><label name="coordinatorResponsibilities">Responsibilities of Coordinator</label>
          <br>
          <input type="text" name="coordinatorResponsibilities" style="width:260px" value="<?php echo $coordinatorResponsibilities; ?>">
        </td>
      </tr>
      <tr>
        <td><br></td>
      </tr>
      <tr>
		<td>
			<label name="targetCompletionDate">Target Completion Date</label>
			<br>
			<select name="targetCompletionDateMonth" id="targetCompletionDateMonth">
		              <option value=""> --- </option>
		              <option value="01">January</option>
		              <option value="02">February</option>
		              <option value="03">March</option>
		              <option value="04">April</option>
		              <option value="05">May</option>
		              <option value="06">June</option>
		              <option value="07">July</option>
		              <option value="08">August</option>
		              <option value="09">September</option>
		              <option value="10">October</option>
		              <option value="11">November</option>
		              <option value="12">December</option>
			</select>
			<script>					
				for(i=0; i<$('targetCompletionDateMonth').options.length; i++) {
					if($('targetCompletionDateMonth').options[i].value=='<? echo $targetCompletionDateMonth ?>') {
						$('targetCompletionDateMonth').options[i].selected = true;
					}
				}
			</script>
			<select name="targetCompletionDateDay" id="targetCompletionDateDay">
				<option value=""> --- </option>
				<?php 
					for($i=1; $i<32; $i++) {
						if($i<10)
							echo "<option value=\"0".$i."\">".$i."</option>";
						else
							echo "<option value=\"".$i."\">".$i."</option>";
					}
				?>
			</select>
			<script>					
				for(i=0; i<$('targetCompletionDateDay').options.length; i++) {
					if($('targetCompletionDateDay').options[i].value=='<? echo $targetCompletionDateDay ?>') {
						$('targetCompletionDateDay').options[i].selected = true;
					}
				}
			</script>
			<select name="targetCompletionDateYear" id="targetCompletionDateYear">
				<option value=""> --- </option>
				<?php						
					for($i=0; $i<10; $i++) {
						$year = date("Y", mktime(0,0,0,1,1,date("Y")+2-$i));
						echo "<option value=\"".$year."\">".$year."</option>";
					}
				?>
			</select>
			<script>					
				for(i=0; i<$('targetCompletionDateYear').options.length; i++) {
					if($('targetCompletionDateYear').options[i].value=='<? echo $targetCompletionDateYear ?>') {
						$('targetCompletionDateYear').options[i].selected = true;
					}
				}
			</script>
		</td>
		<td></td>
		<td>
			<label name="actualCompletionDate">Actual Completion Date</label>
			<br>
			<select name="actualCompletionDateMonth" id="actualCompletionDateMonth">
		              <option value=""> --- </option>
		              <option value="01">January</option>
		              <option value="02">February</option>
		              <option value="03">March</option>
		              <option value="04">April</option>
		              <option value="05">May</option>
		              <option value="06">June</option>
		              <option value="07">July</option>
		              <option value="08">August</option>
		              <option value="09">September</option>
		              <option value="10">October</option>
		              <option value="11">November</option>
		              <option value="12">December</option>
			</select>
			<script>					
				for(i=0; i<$('actualCompletionDateMonth').options.length; i++) {
					if($('actualCompletionDateMonth').options[i].value=='<? echo $actualCompletionDateMonth ?>') {
						$('actualCompletionDateMonth').options[i].selected = true;
					}
				}
			</script>
			<select name="actualCompletionDateDay" id="actualCompletionDateDay">
				<option value=""> --- </option>
				<?php 
					for($i=1; $i<32; $i++) {
						if($i<10)
							echo "<option value=\"0".$i."\">".$i."</option>";
						else
							echo "<option value=\"".$i."\">".$i."</option>";
					}
				?>
			</select>
			<script>					
				for(i=0; i<$('actualCompletionDateDay').options.length; i++) {
					if($('actualCompletionDateDay').options[i].value=='<? echo $actualCompletionDateDay ?>') {
						$('actualCompletionDateDay').options[i].selected = true;
					}
				}
			</script>
			<select name="actualCompletionDateYear" id="actualCompletionDateYear">
				<option value=""> --- </option>
				<?php		
					for($i=0; $i<10; $i++) {
						$year = date("Y", mktime(0,0,0,1,1,date("Y")-$i));
						echo "<option value=\"".$year."\">".$year."</option>";
					}
				?>
			</select>
			<script>					
				for(i=0; i<$('actualCompletionDateYear').options.length; i++) {
					if($('actualCompletionDateYear').options[i].value=='<? echo $actualCompletionDateYear ?>') {
						$('actualCompletionDateYear').options[i].selected = true;
					}
				}
			</script>
		</td>
      </tr>
      <tr>
		<td><br></td>
      </tr>
      <tr>
		<td colspan="3">
			<p><strong> 
				CONTRACT:  It is understood that this program has been 
				developed with the full participation of all persons involved 
				and may be revised at the request of, or with the agreement 
				of, the person being served by <?php echo THIS_CIL;?> . 
			</strong></p>
		</td>
      </tr>
      <tr>
		<td colspan="3">
			<input name="ilpCopySignoff" type="checkbox" <?php if($ilpCopySignoff=="1") echo "checked";?>>
			<label> I acknowledge that I have received a copy of this ILP. </label>
		</td>
      </tr>
      <tr>
		<td><br></td>
      </tr>
      <tr>
		<td>
			<label name="ilpConsumerSig">Consumer Signature</label>
			<br>
			<input type="text" style="width:225px" name="ilpConsumerSig" value="<?php echo $ilpConsumerSig; ?>">
		</td>
		<td><br></td>
		<td>
			<label name="ilpGuardianSig">Guardian Signature</label>
			<br>
			<input type="text" style="width:225px" name="ilpGuardianSig" value="<?php echo $ilpGuardianSig; ?>">
		</td>
      </tr>
      <tr>
		<td><br></td>
      </tr>
      <tr>
		<td>
			<label name="ilpSocialServiceSig">Social Service Agency</label>
			<br>
			<input type="text" style="width:225px" name="ilpSocialServiceSig" value="<?php echo $ilpSocialServiceSig; ?>">
		</td>
		<td><br></td>
		<td>
			<label name="ilpCoordinatorSig">Coordinator Signature</label>
			<br>
			<input type="text" style="width:225px" name="ilpCoordinatorSig" value="<?php echo $ilpCoordinatorSig; ?>">
		</td>
	</tr>
      <tr>
		<td><br></td>
      </tr>
      <tr>
		<td colspan="3"><h3>ILP Waiver :  CSR</h3></td>
      </tr>
      <tr>
		<td colspan="3"><p> 
			At this time, I want to sign a waiver of making the Independent
			Living Plan.  However, a consumer service plan will indicate the 
			services I will be receiving from the Center&#39;s staff.  I 
			understand that I can always come back and have my Independent
			Living Plan written at a later time if I choose to do so. </p>
		</td>
      </tr>
      <tr>
		<td colspan="3">
			<label name="csrConsumerSig">My signature of waiver of an Independent Living Plan</label>
			<input type="text" style="width:225px" name="csrConsumerSig" value="<?php echo $csrConsumerSig; ?>">
		</td>
      </tr>
      <tr>
		<td><br></td>
      </tr>
      <tr>
		<td colspan="3" align="right">
			<input name="id" type="hidden"  value="<?php echo $id;?>">
			<input value="Submit" class="btn" type="submit">
			<input class="btn" type="button" value="Cancel" 
					   onclick="window.location='admin.php?action=cieedit&id=<?php echo $id;?>';"/>
		</td>
      </tr>
    </tbody>
  </table>
</div>
<br>
<br>
</form>
